package com.suning.framework.TetMatch;

import org.apache.commons.lang.StringUtils;

/**
 * 〈一句话功能简述〉<br>
 * 〈功能详细描述〉
 *
 * @author 16080951(林健)
 * @Copyright (c) 2016 XXX技术有限公司 版权所有
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本] （可选）
 */
public class TestMatch {


    public static String genInsert(String cols[],String data[]) {

        StringBuilder sb = new StringBuilder("INSERT INTO TABLE ");

        sb.append("(");
        sb.append(StringUtils.join(cols, ","));
        sb.append(")");
        sb.append(" VALUES ");
        sb.append("(");
        for (String dataInfo : data) {
            sb.append("'");
            sb.append(dataInfo);
            sb.append("',");
        }
        sb = new StringBuilder(sb.substring(0, sb.length() - 1));
        sb.append(")");
        return sb.toString();
    }

    public static void main(String[] args) {

        String a = "`2016-09-22 11:09:23,`wxb12b0b70efada027,`1374864402,`0.00,`0.10%~";
        String data[] = a.replaceAll("`", "").split(",");
        String colsName[] = { "time","sn","mobile","value","pence" };
        String result = genInsert(colsName, data);
        System.out.println(result);


    }
}
